---
title: Installing Apache PredictionIO (incubating) from Source Code
---

<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

INFO: Assuming you are following the directory structure in the following,
replace `/home/abc` with your own home directory wherever you see it.

## Downloading Source Code

Download Apache PredictionIO (incubating) <%= data.versions.pio %> from an
Apache [mirror](https://www.apache.org/dyn/closer.cgi/incubator/predictionio/<%=
data.versions.pio %>/apache-predictionio-<%= data.versions.pio %>.tar.gz). 

## Building

Run the following at the directory where you downloaded the source code to build
Apache PredictionIO (incubating). By default, the build will be against

* Scala 2.10.6
* Spark 1.6.3
* Hadoop 2.6.5
* Elasticsearch 1.7.6

```
$ tar zxvf apache-predictionio-<%= data.versions.pio %>.tar.gz
$ cd apache-predictionio-<%= data.versions.pio %>
$ ./make-distribution.sh
```

You should see something like the following when it finishes building
successfully.

```
...
PredictionIO-<%= data.versions.pio %>/sbt/sbt
PredictionIO-<%= data.versions.pio %>/conf/
PredictionIO-<%= data.versions.pio %>/conf/pio-env.sh
PredictionIO binary distribution created at PredictionIO-<%= data.versions.pio %>.tar.gz
```

Extract the binary distribution you have just built.

```
$ tar zxvf PredictionIO-<%= data.versions.pio %>.tar.gz
```

### Building against Different Versions of Dependencies

Starting from version 0.11.0, PredictionIO can be built against different
versions of dependencies. As of writing, one could build PredictionIO against
these different dependencies:

* Scala 2.10.x, 2.11.x
* Spark 1.6.x, 2.0.x, 2.1.x
* Hadoop 2.4.x to 2.7.x
* Elasticsearch 1.7.x, 5.x

As an example, if you want to build PredictionIO to support Scala 2.11.8,
Spark 2.1.0, and Elasticsearch 5.3.0, you can do

```
$ ./make-distribution.sh -Dscala.version=2.11.8 -Dspark.version=2.1.0 -Delasticsearch.version=5.3.0
```

## Installing Dependencies

Let us install dependencies inside a subdirectory of the Apache PredictionIO
(incubating) installation. By following this convention, you can use
Apache PredictionIO (incubating)'s default configuration as is.

```
$ mkdir PredictionIO-<%= data.versions.pio %>/vendors
```


### Spark Setup

<%= partial 'shared/install/spark' %>


### Storage Setup

#### <a name="pgsql"></a>PostgreSQL Setup

WARNING: You may skip this section if you are not using PostgreSQL.

<%=partial 'shared/install/postgres' %>

#### HBase and Elasticsearch Setup

##### Elasticsearch Setup

WARNING: You may skip this section if you are not using Elasticsearch.

<%= partial 'shared/install/elasticsearch' %>


##### <a name="hbase"></a>HBase Setup

WARNING: You may skip this section if you are not using HBase.

<%= partial 'shared/install/hbase' %>


In addition, you must set your environment variable `JAVA_HOME`. For example, in
`/home/abc/.bashrc` add the following line:

```
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
```


<%= partial 'shared/install/dependent_services' %>





Now you have installed everything you need!

<%= partial 'shared/install/proceed_template' %>
